<?php
declare (strict_types=1);

namespace app\exam\model;

use app\common\model\BaseModel;

/**
 * 试题练习记录模型
 */
class TopicCollect extends BaseModel
{
    /**
     * 表名
     *
     * @var string
     */
    protected $name = 'exam_topic_collect';

    
    /**
     * 设置自动写入时间
     * @var boolean
     */
    protected $autoWriteTimestamp = true;

    /**
     * 删除时间
     */
    protected $deleteTime = false;

    /**
     * 定义字段类型
     * @var array
     */
    protected $type = [
        'user_id'         => 'integer',
        'topic_id'        => 'integer',
        'create_time'     => 'integer',
    ];


    public function topic()
    {
    	return $this->belongsTo(Topic::class, 'topic_id');
    }

    public function topicTitle()
    {
        return $this->belongsTo(Topic::class, 'topic_id')->bind(['topic_title' => 'title']);
    }

    public function topicBasic()
    {
        return $this->belongsTo(Topic::class, 'topic_id')->bind(['topic_title' => 'title', 'question_type']);
    }
}